from PySide6.QtCore import Qt, QPointF, Signal
from PySide6.QtGui import QVector3D
from PySide6.QtDataVisualization import Q3DScatter, Q3DScene


class CustomScatter(Q3DScatter):
    clickValidated = Signal()

    def __init__(self, parent=None):
        super().__init__(parent)
        self._pending_queries = {}
        self.setSelectionMode(Q3DScatter.SelectionItem)
        # 正确连接信号
        # self.scene().queriedGraphPosition.connect(self.handle_graph_query)

    def mousePressEvent(self, event):
        super().mousePressEvent(event)
        pos = event.pos()

        # 发起图形位置查询
        self.clickValidated.emit()
